home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
9-Digit Zip Code Directory
/
9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO
/
z4src.zip
/
DIHDRWRT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-07-29
|
2KB
|
77 lines
//----------------------------------------------------------------------------
// MODULE DESCRIPTION
//
// Module: dihdrwrt.c
// Title: Data File I/O Library
// Notice: John M. Weeder
// Copyright (c) 1993. All rights reserved.
// This module contains proprietary information and should be
// treated as confidential.
//
//----------------------------------------------------------------------------
// MAINTENANCE HISTORY
//
// $Workfile$
// $Revision$
// $Author$
// $Date$
// $Log$
//
//----------------------------------------------------------------------------
// MODULE NARRATIVE
//
//
// This module contains code to write a data file header.
//
// The code in this module should be written entirely in C.
// Do not use any C++ constructs.
//
// This module is portable to:
// DOS 3.X+
// MS Windows 3.X+
// OS/2 2.X+
// OS/2 2.0 PM
// SCO UNIX.
//
// The following compilers are supported:
// MSC 6.0A
// MSC/C++ 7.0
// Borland C++ 3.1 for DOS
// Borland C++ 1.0 for OS/2 2.X
// SCO UNIX cc
//
//----------------------------------------------------------------------------
#include <di.h>
//----------------------------------------------------------------------------
// Description: Write file header of a data file given the table offset.
// Parameters: hpf Physical file handle
// phdr Buffer to read header into.
// Returns: TRUE if successful.
//----------------------------------------------------------------------------
BOOL FN_E DioHeaderWrite(HPF hpf, PDATAHDR phdr)
{
time_t now = time(NULL);
Assert(phdr);
Assert(hpf >= 0 && hpf < MAX_PHYSICAL_FILES);
Assert(di.physical[hpf].fUsed);
Assert(di.physical[hpf].fWriteable);
if (di.physical[hpf].fl & PF_ERROR) // Check for file error
return FALSE;
phdr->timetModified = now; // Update modify time and CRC
phdr->crc = (ULONG)CrcCalc((PBYTE)phdr, sizeof(DATAHDR) - sizeof(ULONG));
if (!FileWrite(di.physical[hpf].hf, phdr, sizeof(DATAHDR), 0L))
{
di.physical[hpf].fl |= PF_ERROR;
return FALSE;
}
return TRUE;
}
//----------------------------------------------------------------------------
//------------------------------- End of File --------------------------------
//----------------------------------------------------------------------------